//go:build !windows

/*
@auther fenglei
*/
package xxsys

import (
	"fmt"
	"gitee.com/fenglei-l/ops-util/xxlog"
)

// 检查端口是否占用,true为占用，false为不占用
func IsPortOccupancy(port int) bool {
	checkStatement := fmt.Sprintf("netstat -tunlp | grep %d", port)
	output, err := ExecCmdSh(checkStatement)
	if len(output) > 0 || err != nil {
		xxlog.ErrorUp366(fmt.Errorf(output, err))
		return true
	}
	return false
}
